import { dateFormat } from '@/util/date';
export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01';
export const endDate = dateFormat(new Date(), 'yyyy-MM-dd');
export const tableOption = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  menu:false,
  searchLabelWidth: 100,
  searchMenuSpan: 6,
  "column": [
	  {
      "type": "input",
      "label": "",
      "prop": "id",
      hide:true,
      display:false,
    },		 {
      "type": "number",
      "label": "办理编号",
      "prop": "applyNum",
      search: true
    },	  {
      "type": "select",
      "label": "公务票类型",
      "prop": "officialType",
      //search:true,
      dicUrl:"/admin/dict/type/st_sw_tk_official_ticket"
    },	  {
      "type": "input",
      "label": "卡号",
      "prop": "cardNum",
      search:true,
    },   {
      "type": "number",
      "label": "旧卡号",
      "prop": "oldCardNum",
      search: true,
    },  {
      "type": "input",
      "label": "姓名",
      "prop": "name",
      search:true,
    },	  {
      "type": "input",
      "label": "身份证号",
      "prop": "idCard",
      search:true,
    },	  {
      "type": "input",
      "label": "所属单位",
      "prop": "belongUnit",
      //cascaderItem: ["underCenter"],
      search:true,
      // props: {
      //   label: 'name',
      //   value: 'name'
      // },
      // dicUrl: "/admin/dept/getRootNode",
    },	  {
      "type": "input",
      "label": "归口中心",
      "prop": "underCenter",
      search:true,
      //search:true,
      // props: {
      //   label: 'name',
      //   value: 'name'
      // },
      // dicFlag:false,
      // dicUrl: "/admin/dept/getChildNode/{{key}}",
    },	  {
      "type": "select",
      "label": "办卡类型",
      "prop": "handleType",
      dicUrl:"/admin/dict/type/st_sw_tk_official_ticket_manage",
      //search:true,
    },	  {
      "type": "datetime",
      "label": "发卡时间",
      "prop": "sendCardTime",
      //search:true,
      //searchValue: [startDate, endDate],
      searchRange: true,
      hide: true,
      display: false,
      searchSpan: 12,
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
    },	  {
      "type": "number",
      "label": "金额",
      "prop": "money",
      hide: true,
      display: false,
	    precision: 2
    },	  {
      "type": "input",
      "label": "车票有效期",
      "prop": "ticketValidityTime",
      hide: true,
      display: false
    },	  {
      "type": "datetime",
      "label": "开始日期",
      "prop": "startTime",
      format: 'yyyy-MM-dd HH:mm',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        message: '请选择开始日期',
        trigger: 'blur'
      }]

    },	  {
      "type": "datetime",
      "label": "截止日期",
      "prop": "endTime",
      format: 'yyyy-MM-dd HH:mm',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        message: '请选择截止日期',
        trigger: 'blur'
      }]
    },{
      "type": "date",
      "label": "截止日期",
      "prop": "endTimeDTO",
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      search: true,
      display: false,
      hide: true
    },{
      "type": "select",
      "label": "线路",
      "prop": "lineCode",
      cascaderItem: ["stationCode"],
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: "/support/swparamline/dict",
      search: true
      }, {
      "type": "select",
      "label": "站点",
      "prop": "stationCode",
      dicFlag: false,
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: "/support/swparamstation/dict/{{key}}",
      search: true   
     },		  {
      "type": "select",
      "label": "票卡状态",
      "prop": "ticketStatus",
      //dicUrl:"/admin/dict/type/st_sw_tk_official_ticket_status"
      formatter: (row, value, label, column) => {
        let endTime = row.endTime;
        let now = new Date();
        if (dateFormat(now)>=endTime) {
          return '已过期';
        }else {
          return '正常';
        }
      },
      search: true,
      dicData: [{
        label: '已过期',
        value: '1'
      }, {
        label: '正常',
        value: '2'
      }],
    },     {
      "type": "select",
      "label": "退卡状态",
      "prop": "backStatus",
      search: true,
      display: false,
      dicData: [{
        label: '未退卡',
        value: '1'
      }, {
        label: '已退卡',
        value: '2'
      }],
      rules: [{
        message: '请选择退卡状态',
        trigger: 'blur'
      }]
    },	 {
      "type": "textarea",
      "label": "备注",
      "prop": "remark",
      search:true,
      span: 24
    },	  {
      "type": "input",
      "label": "部门id",
      "prop": "deptId",
      hide:true,
      display:false,
    },	  {
      "type": "input",
      "label": "创建人id",
      "prop": "creatorId",
      hide:true,
      display:false,
    },	  {
      "type": "input",
      "label": "创建人",
      "prop": "creatorName",
      hide:true,
      display:false,
    },	  {
      "type": "input",
      "label": "创建时间",
      "prop": "createTime",
      hide:true,
      display:false,
    },	  {
      "type": "input",
      "label": "修改时间",
      "prop": "updateTime",
      hide:true,
      display:false,
    },	  {
      "type": "input",
      "label": "删除:1 未删除0",
      "prop": "delFlag",
      hide:true,
      display:false,
    }  ]
}
